#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int MAXN = 1e5 + 10;
const int MOD = 1e9 + 7;

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    int t;
    ll n;

    cin >> t;
    while (t--) {
        cin >> n;
        if (n & 1 || n == 2) {
            cout << -1 << endl;
            continue;
        }

        n /= 2;

        ll mi = 1e9, mx = 0;

        if (n < 4) {
            cout << "1 1" << endl;
            continue;
        }

        switch (n % 3) {
        case 0:
            mi = n / 3;
            break;
        case 1:
            mi = (n - 4) / 3 + 2;
            break;
        case 2:
            mi = (n - 2) / 3 + 1;
            break;
        default:
            break;
        }

        if (n & 1) {
            mx = max(mi, 1 + (n - 3) / 2);
        }
        else {
            mx = max(mi, n / 2);
        }


        cout << mi << ' ' << mx << endl;
    }
    return 0;
}